#!/bin/bash
killall -c mbbservice
#rm -rf /Library/StartupItems/MobileBrServ
rm -rf /Library/StartupItems/MobileBrServ/MobileBrServ
rm -rf /Library/StartupItems/MobileBrServ/SysConfig.dat
rm -rf /Library/StartupItems/MobileBrServ/StartupParameters.plist
rm -rf /Library/StartupItems/MobileBrServ/mbbservice
rm -rf /Library/StartupItems/MobileBrServ/mbbserviceUninstall.app
rm -rf /Library/StartupItems/MobileBrServ/runmbbserviceopen
rm -rf /Library/StartupItems/MobileBrServ/mbbserviceopen.app
rm -rf /tmp/mbbservice.pid
rm -rf /usr/local/mbbservice.log

chmod a+w /usr
mkdir /usr/local

chmod 0440 /private/etc/sudoers

#echo $1 > /log.txt
#cp -Rf "${1}" /Library/StartupItems/MobileBrServ
installer -pkg "${1}" -target /
cp -Rf "${1}/../mbbserviceopen.app" "/Library/StartupItems/MobileBrServ/mbbserviceopen.app"
#cp -f "${1}/../mbbserviceSetup.pkg/Contents/Resources/ArConfig.dat" "/Library/StartupItems/MobileBrServ/"
chown -R root:wheel /Library/StartupItems/MobileBrServ
chmod -R 755 /Library/StartupItems/MobileBrServ
chmod -R a+wrx /Library/StartupItems/MobileBrServ/mbbserviceopen.app
#open -a /Library/StartupItems/MobileBrServ/MobileBrServ &

